<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<div class="span12 box-content">
	<form class="form-inline well" id="classFilter_form">
		<div class="controls controls-row">
			<label>学院:</label>
			<select class="span2" style="display:inline;" name="college">
			  <c:forEach items="${colleges }" var="c">
			 	 <option value="${c.id }" ${c.id==clgId?"selected='selected'":""}>${c.name }</option>
			  </c:forEach>
			</select>
			<button type="button" id="classFilter_go">筛选</button>
		</div>
	</form>
	<div class="span12">共有${classCount}条数据,${totalPage }页</div>
	<table class="table table-striped table-bordered" id="class_list_table">
		<thead>
		 <tr role="row">
		 	<th >班级编号</th>
		 	<th>班级名</th>
		 	<th>索引</th>
		 	<th>更多</th>
		 </tr>
		</thead>   
		<tbody>
		<c:forEach items="${classList }" var="c">
			<tr>
				<td>${c.no }</td>
				<td>${c.name }</td>
				<td>${c.branch.prof.department.college.name}>${c.branch.prof.department.name}>${c.branch.prof.name }>${c.branch.name }</td>
				<td>
				<c:if test="${!user.superAdmin&&user.collegeId!=c.branch.prof.department.college.id}">
					<c:set var="editDisabled" value="disabled"/>
				</c:if>
					<button type="button" class="btn btn-info class_edit" data-classId="${c.id }" data-target="#class_edit_box" data-toggle="modal" ${editDisabled }>
						<i class="icon-edit icon-white"></i>  
						编辑
					</button>
					<button type="button" class="btn btn-danger class_delete"  data-target="#class_delete_box" data-toggle="modal" data-classId="${c.id }" ${editDisabled }>
						<i class="icon-trash icon-white"></i>  
						删除
					</button>
					<c:if test="${editDisabled!=null }">
						无权操作
					</c:if>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination  pagination-centered"
			data-totalPage="${totalPage }" 
			data-currentPage="${page }" 
			data-url="<%=basePath%>admin/class/showClassList/${clgId }/{page}"
			style="display:none">
	</div>
	<div class="well">
		<button type="button" class="btn btn-primary" id="class_add"  data-target="#class_add_box" data-toggle="modal" >
			<i class=" icon-plus icon-white"></i>  
			新建一个班级
		</button>
		<button type="button" class="btn btn-primary" id="class_add_bulk"  data-target="#class_add_bulk_box" data-toggle="modal" >
			<i class=" icon-plus icon-white"></i>  
			批量新建班级
		</button>
	</div>
</div>
<!-- 信息修改 开始 -->
<div class="modal hide fade" id="class_edit_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3>编辑</h3>
	</div>
	<div class="modal-body">
		<div  class="ajax_wait" style="text-align: center;"><img src="<%=basePath %>images/ajax-loader.gif" title="wait" /></div>
		<div id="class_edit_box_alert_container" ></div><br/>
		<form class="form-horizontal" id="class_edit_box_form" style="display: none;">
			<input name="class_id"size="16" type="hidden">
			<div class="control-group">
				<label class="control-label">班级编号</label>
				<div class="controls">
					<input name="class_no"size="16" type="text">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">班级名</label>
				<div class="controls">
					<input name="class_name"size="16" type="text">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">所属学院</label>
				<div class="controls">
				<c:if test="${!user.superAdmin }">
					<c:set var="cglDisable" value="disabled"/>
				</c:if>
					<select  name="college"  ${cglDisable }>
						<c:forEach items="${colleges }" var="c" >
							<option value="${c.id }" >${c.name }</option>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">所属系</label>
				<div class="controls">
					<select  name="department" data-org="0">
					</select>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">所属专业</label>
				<div class="controls">
					<select  name="profession" data-org="0">
					</select>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">所属专业方向</label>
				<div class="controls">
					<select  name="branch" data-org="0">
					</select>
				</div>
			</div>
		</form>
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">取消</a>
		<a href="#" class="btn btn-primary" id="class_edit_box_save">保存</a>
	</div>
</div>
<!-- 信息修改 结束 -->
<!-- 删除确认 开始-->
<div class="modal hide fade" id="class_delete_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3>删除班级</h3>
	</div>
	<div class="modal-body">
		<input type="hidden" name="classId"/>
            确认删除?删除动作不可撤销!
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">取消</a>
		<a href="#" class="btn btn-danger" id="class_delete_box_delete">删除</a>
	</div>
</div>
<!-- 删除确认 结束 -->
<!-- 添加 开始 -->
<div class="modal hide fade" id="class_add_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3>新建一个班级</h3>
	</div>
	<div class="modal-body">
		<div id="class_add_box_alert_container" ></div><br/>
		<form class="form-horizontal" id="class_add_box_form">
			<div class="control-group">
				<label class="control-label">班级编号</label>
				<div class="controls">
					<input name="class_no"size="16" type="text">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">班级名</label>
				<div class="controls">
					<input name="class_name"size="16" type="text">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">所属学院</label>
				<div class="controls">
				<c:if test="${!user.superAdmin }">
					<c:set var="cglDisable" value="disabled"/>
				</c:if>
					<select  name="college"  ${cglDisable }>
						<c:forEach items="${colleges }" var="c" >
							<c:if test="${!user.superAdmin }">
								<option value="${c.id }"  ${user.collegeId==c.id?"selected":"" }>${c.name }</option>
							</c:if>
							<c:if test="${user.superAdmin }">
								<option value="${c.id }" >${c.name }</option>
							</c:if>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">所属系</label>
				<div class="controls">
					<select  name="department">
					</select>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">所属专业</label>
				<div class="controls">
					<select  name="profession">
					</select>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">所属专业方向</label>
				<div class="controls">
					<select  name="branch">
					</select>
				</div>
			</div>
		</form>
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">取消</a>
		<a href="#" class="btn btn-primary" id="class_add_box_save">保存</a>
	</div>
</div>
<!-- 添加 结束 -->
<!-- 批量添加开始 -->
<div class="modal hide fade" id="class_add_bulk_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3>批量新建班级</h3>
	</div>
	<div class="modal-body">
		<div id="class_add_box_bulk_alert_container" ></div><br/>
		<form class="form-horizontal" id="class_add_box_bulk_form">
			<div class="control-group">
				<label class="control-label">班级起始编号</label>
				<div class="controls">
					<input name="class_no"size="16" type="text">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">班级名格式</label>
				<div class="controls">
					<input name="class_name"size="16" type="text" placeholder="如:网络安全x班">
					<p class="help-block">
						帮助:格式中的x为替换的数字<br/>
						例如输入网络安全x班,则会生成网络安全1班,网络安全2班.....<br/>
						若没有输入x,则数字加在尾部,如网络安全1 网络安全2<br/>
						</p>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">所属学院</label>
				<div class="controls">
				<c:if test="${!user.superAdmin }">
					<c:set var="cglDisable" value="disabled"/>
				</c:if>
					<select  name="college"  ${cglDisable }>
						<c:forEach items="${colleges }" var="c" >
							<c:if test="${!user.superAdmin }">
								<option value="${c.id }"  ${user.collegeId==c.id?"selected":"" }>${c.name }</option>
							</c:if>
							<c:if test="${user.superAdmin }">
								<option value="${c.id }" >${c.name }</option>
							</c:if>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">所属系</label>
				<div class="controls">
					<select  name="department">
					</select>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">所属专业</label>
				<div class="controls">
					<select  name="profession">
					</select>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">所属专业方向</label>
				<div class="controls">
					<select  name="branch">
					</select>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">批量创建数目</label>
				<div class="controls">
					<select  name="count">
					</select>
				</div>
			</div>
		</form>
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">取消</a>
		<a href="#" class="btn btn-primary" id="class_add_bulk_box_save">保存</a>
	</div>
</div>
<!-- 批量添加结束 -->